<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@taglib uri="/WEB-INF/page-base.tld" prefix="w" %>
<%String path = request.getContextPath(); %>
<style>
    .btn {
        text-decoration: none;
        background-color: #00A4F2;
        color: #fff;
        padding: 5px 20px;
        border-radius: 5px;
    }

    .btn:hover {
        background-color: #00ADFF;
    }

    .ui-btn {
        padding: 15px;
    }

    .newbtna {
        color: red;
        text-decoration: none;
        margin-left: 2px;
    }

    .inpradio {
        margin-top: 0;
    }

    .datainp {
        width: 173px;
        height: 30px !important;
        border: 1px #A5D2EC solid;
    }

    .wicon {
        background-image: url(
        "");
        background-repeat: no-repeat;
        background-position: right center;
    }

    #errormsg {
        position: fixed;
        width: 200px;
        height: 50px;
        line-height: 50px;
        padding: 1px 5px;
        text-align: center;
        background-color: #00A4F2;
        opacity: 0.5;
        color: #fff;
        left: 50%;
        margin-left: -50px;
        top: 50%;
        border-radius: 20px;
    }
    .radio-top{
        margin-top: -2px;
    }
</style>
<form id="cutform" method="post" action="/marketing/FillReductionPage@chooseMoneyList.page">
    <div id="errormsg" style="display: none;"></div>
    <div class="headT">
        <span></span>
        <label>活动定义</label>
    </div>
    <div class="ui-formContent">
        <p>
            <w:hidden bind="bean.id" name="moneyid"/>
            <w:hidden bind="bean.promotid" name="promotionid"/>
            <w:hidden bind="bean.start_time"/>
            <w:hidden bind="bean.end_time"/>
            <label style="width:130px;text-align:right">推广平台：</label>
            <label class="radioButton"><input id="all" name="platform" checked="checked" class="radio-top" type="radio" value="0"/>全平台
                <input id="pc" name="platform" type="radio" class="radio-top" value="1"/>PC端
                <input id="wxd" name="platform" type="radio" class="radio-top" value="2"/>微商城</label>
            <font class="red">*</font>
            <label style="width:130px;text-align:right">活动时间：</label>
            <input class="datainp wicon" id="singEditInpstart" name="starttime" value="" type="text" placeholder="请选择"
                   readonly>到
            <input class="datainp wicon" id="singEditinpend" name="endtime" value="" type="text" placeholder="请选择"
                   readonly>
            <font class="red">*</font>
        </p>
        <p>
            <label style="width:130px;text-align:right">活动标题：</label>
            <input name="promotname" style="width:742px" maxlength="45" styleClass="easyui-validatebox"
                   autocomplete="off"/>
            <font class="red">*</font>
        </p>
        <p>
            <label style="width:130px;text-align:right">活动描述：</label>
            <input name="description" style="width:742px;" maxlength="30" styleClass="easyui-validatebox"
                   autocomplete="off"/>
        </p>
        <p>
            <label style="width:130px;text-align:right">排序：</label>
            <input name="sort_value" style="width:100px" maxlength=8"
                   onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
                   styleClass="easyui-validatebox" autocomplete="off"/>
        </p>
        <p>
            <label style="width:130px;text-align:right">活动专区描述：</label>
            <input name="district_description" style="width:731px" maxlength="16" styleClass="easyui-validatebox"
                   autocomplete="off"/>
        </p>
    </div>
    <div class="headT">
        <span></span>
        <label>规则限制</label>
    </div>
    <div class="ui-formContent">
        <p id="select">
            <label style="width:130px;text-align:right">活动规则：</label>
            <label class="radioButton"><input id="mj" name="bean2" checked="checked" class="inpradio" type="radio"
                                              value="0"/>满减</label>
            <label class="radioButton"><input id="mz" name="bean2" type="radio" class="inpradio" value="1"/>满折</label>
            <font class="red">*</font>
        </p>
        <div id="pro1">
            <p style="margin-left: 153px;display: none;" class="cut" id="cut" name="money_tag">
                满<input type="text" onblur="inputcheck(this)" name="off_money" maxlength="8" autocomplete="off"
                        value="<w:write bind="#info.off_money"/>"
                        style="width:100px;margin:0 5px;">
                减<input type="text" onblur="inputcheck(this)" name="discount_money" maxlength="8" autocomplete="off"
                        value="<w:write bind="#info.discount_money"/>"
                        style="width:100px;margin:0 5px;">
                <a id="cut_add" href="#" style="color: red;text-decoration: none;">[+] </a>

            </p>
        </div>
        <div id="pro2">
            <p style="margin-left: 153px;display: none;" name="money_tag_rate" class="folding" id="folding">
                满<input autocomplete="off" type="text" name="off_money_rat" maxlength="8" onblur="inputcheck(this)"
                        value="<w:write bind="#item.off_money"/>"
                        style="width:100px;margin:0 5px;">
                折扣 <input autocomplete="off" type="text" name="discount_rate" maxlength="2"
                          oninput="this.value=this.value.trim().replace(/[^\d]/g,'');"
                          onblur="this.value=this.value.trim().replace(/[^\d]/g,'');if(this.value.length==1){this.value='0'+this.value;}"
                          value="<w:write bind="#item.discount_rate"/>"
                          style="width:100px;margin:0 5px;"> %
                <a id="folding_add" href="#" style="color: red;text-decoration: none;">[+]</a>
                <em style="color: #888888;font-style: normal;">( 如需要打八折,请输入80 )</em>
            </p>
        </div>

        <div style="border-top: 1px solid #D1D0EA;"></div>
        <p>
            </font>
            <label style="width:130px;text-align:right">参与次数：</label>
            <input name="time" style="width:100px" styleClass="easyui-validatebox" autocomplete="off"
                   onkeyup="this.value=this.value.replace(/[^\d]/g,'')"/>次
        </p>
        <div style="border-top: 1px solid #D1D0EA;"></div>
        <p>
            <label style="width:130px;text-align:right;float: left;">客户范围：</label>
            <select name="controlsales" id="controlsales"
                    style="width:386px;height:200px;border:1px solid #DDDDDD;margin-left: 9px;" multiple="multiple">
                <w:iterate id="info" bind="#controlsales">
                    <option value="{'type':'<w:write bind="#info.type"/>','val':'<w:write bind="#info.val"/>','text':'<w:write bind="#info.text"/>'}">
                        <w:write bind="#info.text"/></option>
                </w:iterate>
            </select>
        </p>
        <div style="margin-top:8px;margin-left: 149px;">
            <a href="javascript:void(0);" class="ui_btn marginR8" onclick="addControlsales()">新增控销</a>
            <a href="javascript:void(0);" class="ui_btn marginR8" onclick="delControlsales()">删除控销</a>
        </div>
    </div>
    <div class="headT">
        <span></span>
        <label>参与方式</label>
    </div>
    <div class="ui-formContent">
        <p style="margin-left: 55px;">
            <label class="radiocolor"><input name="bean4" id="qc" type="radio" class="inpradio" value="0">全场商品</label>
            <label class="radiocolor"><input name="bean4" id="bf" type="radio" class="inpradio" value="2" checked="">部分商品参加</label>
            <label class="radiocolor"><input name="bean4" id="zd" type="radio" class="inpradio" value="3">指定类目</label>
        </p>

        <p id="puctfl">
            <label title="商品分类" style="width:130px;text-align:right">商品分类：</label>
            <select id="classtree1" name="class_name" class="easyui-combotree" style="width:250px;height:28px;"
                    data-options="url:'<%=path %>/products/ProductClassPage@loadClassTree2.page'"></select>
        </p>
    </div>
    </div>
    <div style="width: 100%;  text-align: center; position: absolute;z-index: 10000;bottom:0;"
         class="ui-buttonBar ui-btn">
        <input type="submit" value="完成"/>
    </div>
    <div class="easyui-panel ui-toolBar" border="false" id="selectpro" data-options="doSize:false">
        <table cellpadding="0" cellspacing="0" style="margin-top:5px">
            <tr>
                <td width="70" align="right">商品名称：</td>
                <td><w:text bind="bean.pname" style="width:120px;height:22px;"/></td>
                <td width="70" align="right">商品分类：</td>
                <td><select id="classtree" name="bean.classid" class="easyui-combotree"
                            style="width:250px;height:28px;"
                            data-options="url:'<%=path %>/products/ProductClassPage@loadClassTree2.page'"></select>
                </td>


                <td width="70" align="right">商品编码：</td>
                <td><w:text bind="bean.code" style="width:300px;height:22px;"
                            onchange="value=(value.match(/\d+/g)||['']).join(',')"/></td>
                <td>
                    &nbsp;<a href="javascript:;" class="easyui-linkbutton" iconCls="icon_search"
                             onclick="query1()">查询</a>
                    &nbsp;<a href="javascript:;" class="easyui-linkbutton" iconCls="icon_search"
                             onclick="resetform()">重置</a>
                    &nbsp;<a href="javascript:;" class="easyui-linkbutton" iconCls="icon_search" onclick="inp(this);"
                             id="see">查看已添加商品</a>
                </td>
            </tr>
        </table>
    </div>

</form>


<div title="部分商品" style="border: 1px solid #DDDDDD;">

    <script>
        window.productItems = {};
        window.productItemsTo = {};
        window.primarys = new Array();
    </script>


    <div style="border: 1px solid #DDDDDD;">
        <div id="chooseShowListPanel" class="easyui-panel" border="false" data-options="doSize:false,href:''">

        </div>
    </div>
</div>
<div style="width: 100%;height: 100px;"></div>

<script>
    $(function () {

        $("a.panel-tool-close").unbind("click");
        $("a.panel-tool-close").click(function (e) {
            if (window.confirm("确认取消添加满减促销活动?")) {
                window.location.reload();
            }
        });
    });

</script>


<script>
    function addoff_id() {
        $("p[name=discount_money]").each(function () {
            var id = $(this).attr("rmenu");
            var bb = $(this).attr("rmenu");
            var cc = $("p[rmenu=" + bb + "]");
            var dd = cc.find("input[type=text]");
            dd.each(function () {
                var inp = $(this).val();
//                console.log("-------" + inp);
                var aaaa = "{'" + id + "':'" + inp + "'}"
//                console.log(aaaa);
            })
        });
    }
    function resetform() {
        $(".ui-toolBar input").val("");
    }

    $(function () {
        var start = $("[name='bean.start_time']").val();
        $("[name='starttime']").val(start)
        var end = $("[name='bean.end_time']").val();
        $("[name='endtime']").val(end);
        chooseShowList();
        var aa = $("#pro2").find("p").attr("id");

    })
    function chooseShowList() {
        $w.execUrl(ctx + "/marketing/FillReductionPage@chooseMoneyList.page", {}, $('#chooseShowListPanel'));
    }

    /*信息不完整，创建活动失败*/
    function Createfailure() {
        $w.errorMsg("信息不完整，创建活动失败!");
    }
    /*活动创建成功*/
    function Createsuccess() {
        $("#errormsg").html("活动创建成功").fadeIn(300).delay(2000).fadeOut(300);
    }
    /*活动未创建成功，直接离开页面？*/
    function Notcreated() {
        window.parent.$w.confirmMsg("活动未创建成功，直接离开页面？", function () {
        })
    }
    /*点击完成按钮验证必填项*/
    $(function () {
        /*当前表单调用validate方法，实现表单验证功能*/
        $("#cutform").validate({
            debug: true, /*调试模式，验证通过也不跳转到目标页面，如要提交跳转修改成false*/
            rules: {
                /*配置验证规则*/
                platform: {
                    required: true/*必填。如果验证方法不需要参数，则配置为true*/
                },
                starttime: {
                    required: true
                },
                endtime: {
                    required: true
                },
                promotname: {
                    required: true
                },
                bean2: {
                    required: true
                },
                off_money_rat: {
                    required: true
                },
                discount_rate: {
                    required: true
                },
                off_money: {
                    required: true
                },
                discount_money: {
                    required: true
                },
                primaryKey_: {
                    required: true
                },
                class_name: {
                    required: true
                },
            },
            messages: {
                platform: {
                    required: "推广平台不能为空，必选一项!"
                },
                starttime: {
                    required: "活动开始时间不能为空"
                },
                endtime: {
                    required: "活动结束时间不能为空"
                },
                promotname: {
                    required: "活动标题不能为空"
                },
                bean2: {
                    required: "活动规则不能为空，必选一项!"
                },
                off_money_rat: {
                    required: "满折金额不能为空"
                },
                discount_rate: {
                    required: "满折折扣不能为空"
                },
                off_money: {
                    required: "满减金额不能为空"
                },
                discount_money: {
                    required: "满减额度不能为空"
                },
                primaryKey_: {
                    required: "指定商品参加,商品不能为空"
                },
                class_name: {
                    required: "请选择你要添加的类目"
                },
            },
            /* 重写错误显示消息方法,以吐司方式弹出错误消息 */
            /*获取单项必填项消息*/
            showErrors: function (errorMap, errorList) {
                var msg = "";
                $.each(errorList, function (i, v) {
                    if (i == 0)//每次只弹出一个提示
                    {
                        msg += (v.message + "\r\n");
                    }
                });
                if (msg != "")
//                    toastr.warning(msg) || toastr.success(msg)
                    $("#errormsg").html(msg).fadeIn(300).delay(2000).fadeOut(300);
            },
            /* 失去焦点时不验证 */
            onfocusout: false,
            submitHandler: function (form) {
                pedit_prodoctupdate();
            }

        });
    });
    //删除控销用户
    function delcontroluser(obj) {
        $(obj).parent().parent().remove();
    }
    //添加控销
    function addControlsales() {
        window.parent.$w.openDialog({
            url: ctx + '/products/ProductPage@addControlsalesShow.page',
            title: "活动控销",
            w: 600,
            h: 400,
            afterClose: function (ret) {
                if (ret && ret.list.length > 0) {
                    var txt = "";
                    var combox = $("#controlsales").get(0);
                    for (var i = 0; i < ret.list.length; i++) {
                        if (ret.type == "1") txt = "客户分组：" + ret.list[i].text;
                        else if (ret.type == "2") txt = "价格等级：" + ret.list[i].text;
                        else if (ret.type == "3") txt = "区域控销：" + ret.list[i].text;
                        val = "{'type':'" + ret.type + "','val':'" + ret.list[i].val + "','text':'" + txt + "'}";
                        combox.options[combox.options.length] = new Option(txt, val);
                    }
                }
            }
        })
    }
    function delControlsales() {
        var combox = $("#controlsales").get(0);
        if (combox.options.length > 0) {
            for (var i = 0; i < combox.options.length; i++) {
                var option = combox.options[i];
                if (option.selected) {
                    combox.options[i] = null;
                    i--;
                }
            }
        }
    }
    /*规则限制单选框根据选中的值显示不同*/
    $(function () {
        showCont();
        $("input[name=bean2]").click(function () {
            showCont();
        });
    });
    function showCont() {
        switch ($("input[name=bean2]:checked").attr("id")) {
            case "mj":
                $(".folding").hide();
                $(".cut").show();
                break;
            case "mz":
                $(".cut").hide();
                $(".folding").show();
                break;
            default:
                break;
        }
    }
    var off_id;
    /*点击满减*/
    $("#cut_add").click(function () {
        $("p[name=money_tag]").each(function () {
            var arr = ( $(this).attr("rmenu"));
            off_id = arr;
        })
        off_id = parseInt(off_id) + 1;
        $("#cut").after("<p style='margin-left: 153px; '  rmenu='" + off_id + "'  class='cut' name='money_tag'>" +
            "满<input name='off_money' value='' onblur='inputcheck(this)' maxlength='8' data-options='required:true' style='width:100px;margin: 0 5px;'>" + '&nbsp;' +
            "减<input name='discount_money' value='' onblur='inputcheck(this)' maxlength='8' data-options='required:true' style='width:100px;margin: 0 5px;'>" +
            "<a  href='javascipt:;' class='newbtna' onclick='del(this)'>&nbsp;[-]</a>" +
            "</p>");
    });
    /*点击满折*/
    $("#folding_add").click(function () {
        $("p[name=money_tag_rate]").each(function () {
            var arr = ( $(this).attr("rmenu"));
            off_id = arr;
        })
        off_id = parseInt(off_id) + 1;
        var foldingatt = $("#pro2").find("p").attr("id");
        $("#folding").after("<p  style='margin-left: 153px; ' rmenu='" + off_id + "'  name='money_tag_rate' class='folding'>" +
            "满<input name='off_money_rat' value='' onblur='inputcheck(this)' maxlength='8' data-options='required:true' style='width:100px;margin: 0 5px;'>" + '&nbsp;' +
            "折扣<input name='discount_rate' value=''  maxlength='2'  oninput='verify_rate(this)' onblur='verify_rate_to(this)' data-options='required:true' style='width:100px;margin: 0 5px;'>%" +
            "<a href='javascript:;' class='newbtna' onclick='del(this)'>&nbsp;[-]</a>" +
            "</p>");
    });

    function inputcheck(obj) {
        obj.value = obj.value.trim().replace(/[^0-9|\.]/g, '');
        obj.value = obj.value.replace(/^\./, '0.');
        obj.value = obj.value.replace(/\.$/, '');
        if (obj.value.indexOf('.') > 0 && obj.value.indexOf('.') != (obj.value.length - 1)) {
            obj.value = obj.value.substring(0, obj.value.indexOf('.') + 1)
                + obj.value.substr(obj.value.indexOf('.') + 1, 2);
        }
        ;
        obj.value = obj.value.replace(/\./g, '_').replace('_', '.').replace(/_/g, '');
    }

    function verify_rate(obj) {
        console.log(111111);
        obj.value = obj.value.trim().replace(/[^\d]/g, '')
    }
    function verify_rate_to(obj) {
        console.log(111111);
        obj.value = obj.value.trim().replace(/[^\d]/g, '');
        if (obj.value.length == 1) {
            obj.value = '0' + obj.value;
        }
    }

    /*点击-号删除*/
    function del(obj) {
        $(obj).parent().remove();
    }
    /*参与方式单选框根据选中的值显示不同*/
    $(function () {
        showactivity();
        $("input[name=bean4]").click(function () {
            showactivity();
        });
    });
    function showactivity() {
        switch ($("input[name=bean4]:checked").attr("id")) {
            case "qc":
                $("#puctfl").hide();
                $("#puctname").hide();
                $("#puctbar").hide();
                $("#puctbtn").hide();
                $("#seetab").hide();
                $("#selectpro").hide();
                $("#seestab").hide();
                break;
            case "bf":
                $("#puctfl").hide();
                $("#puctname").show();
                $("#puctbar").show();
                $("#puctbtn").show();
                $("#seetab").show();
                $("#selectpro").show();
                break;
            case "zd":
                $("#puctfl").show();
                $("#puctname").hide();
                $("#puctbar").hide();
                $("#puctbtn").hide();
                $("#seetab").hide();
                $("#selectpro").hide();
                $("#seestab").hide();
                break;
            default:
                break;
        }
    }

    //实现日期选择联动
    var start = {
        format: 'YYYY-MM-DD hh:mm:ss',//日期格式
        minDate: $.nowDate({DD: 0}), //设定最小日期为当前日期
        maxDate: '2099-06-16 23:59:59', //最大日期
        festival: true,//是否显示节日
        isClaer: true,//是否显示清空
        isinitVal: false,//是否初始化时间
        zIndex: 300000,//层级高度
        choosefun: function (elem, datas) {
            end.minDate = datas; //开始日选好后，重置结束日的最小日期
            endDates();
        },//选中日期回调
        okfun: function (elem, datas) {
//            alert(datas)
        }//点击确定回调
    };
    var end = {
        format: 'YYYY-MM-DD hh:mm:ss',//日期格式
        minDate: $.nowDate({DD: 0}), //设定最小日期为当前日期
        maxDate: '2099-06-16 23:59:59', //最大日期
        festival: true,//是否显示节日
        isClaer: true,//是否显示清空
        isinitVal: false,//是否初始化时间
        zIndex: 300000,//层级高度
        choosefun: function (elem, datas) {
            start.maxDate = datas; //将结束日的初始值设定为开始日的最大日期
        }
    };
    //日期联动
    function endDates() {
        end.trigger = false; //结束日期的事件改成false
        $("#singEditinpend").jeDate(end);
    }
    $("#singEditInpstart").jeDate(start);
    $("#singEditinpend").jeDate(end);
</script>
<script>
    function query1() {
        $w.execForm({form: $('#cutform'), target: $('#chooseShowListPanel'), pageNum: 1})
    }
    function pedit_prodoctupdate() {
//        $.messager.progress();
        pedit_saveProduct();
    }
    var pedit_saveing = false;

    function pedit_saveProduct() {
        if ($("input[name='bean4']:checked").val() == 3) {
            if ($("input[name='class_name']").val() == "" || $("input[name='class_name']").val() == "null") {
                $("#errormsg").html("请选择要添加的类目").show(300).delay(3000).hide(300);
                return false;
            }
        }

        if (!pedit_saveing) {
            if (!pedit_saveing) {
                pedit_saveing = true;//防止重复保存
                var data = productdata();
                if (!data) {
                    pedit_saveing = false;
                    return false;
                }
                $w.doUrl(ctx + "/marketing/FillReductionPage@update.page", data, function (ret) {
                    $.messager.progress('close');
                    if (ret.state == 'ok') {
                        window.parent.$w.correctMsg("保存商品成功");
                        $w.closeCurrWin("ok");
                    } else if (ret.state == 'no') {
                        pedit_saveing = false;
                        window.parent.$w.alertMsg("编辑失败,商品已参加活动");
                    } else {
                        pedit_saveing = false;
                        window.parent.$w.alertMsg(ret.state);
                    }
                })
            }
        }
        //组合数据

        function productdata() {
            var win = $w.currWin();
            var data = {
                "bean.promotid": $("[name='moneyid']").val(),
                "bean.start_time": $("#singEditInpstart").val(),
                "bean.name": $("[name='promotname']").val(),
                "bean.end_time": $("#singEditinpend").val(),
                "bean.description": $("[name='description']").val(),
                "bean.classid": $("[name='class_name']").val(),
                "bean.time": $("[name='time']").val(),
                "bean.classname": $("[name='classname']").val(),
                "bean.sort_value": $("[name='sort_value']").val(),
                "bean.district_description": $("[name='district_description']").val()
            };
            data["bean.platform"] = $("input[name='platform']:checked").val();


            data["bean.product_type"] = $("input[name='bean4']:checked").val();
            data["bean.moneyoff_type"] = $("input[name='bean2']:checked").val();

//            var checkbox1 = []
//            $('input[name="primaryKey_"]:checked').each(function () {
//                checkbox1.push($(this).val());
//            });
            var productid_items = [];

            if (productItemsTo) {
                for (var key in productItemsTo) {
                    var val = productItemsTo[key];
                    console.log(val);
                    if (val.showlistidto) {
                        productid_items.push(val.showlistidto);
                    }
                }
            }
            data["bean.product_val"] = JSON.stringify(productid_items);
            var controlsales = "";//控销数据
            var combox = $("#controlsales").get(0);
            for (var i = 0; i < combox.options.length; i++) {
                if (controlsales != "") controlsales += ",";
                controlsales += combox.options[i].value;
            }
            data["bean.controlsales"] = "[" + controlsales + "]";
            var controlusers = "";//控销用户
            $("[name='controluserid']").each(function () {
                controlusers += this.value + ",";
            })
            data["bean.controlusers"] = controlusers

            var items = [];
            var off_money_add_flag = true;
            var money_size_flag = true;

            if ($("input[name='bean2']:checked").val() == 0) {
                $("[name='money_tag']").each(function () {
                    if ($(this).find("[name='off_money']").val() == "" || $(this).find("[name='discount_money']").val() == "") {
                        off_money_add_flag = false;
                        return false;
                    }
                    //判断满金额必须大于减金额
                    if (($(this).find("[name='off_money']").val() - $(this).find("[name='discount_money']").val()) <= 0) {
                        money_size_flag = false;
                        return false;
                    }
                    var item = {};
                    item["off_money"] = $(this).find("[name='off_money']").val();
                    item["discount_money"] = $(this).find("[name='discount_money']").val();
                    items.push(item);
                });
            }
            data["bean.bean2"] = $("input[name='bean2']:checked").val();
            if ($("input[name='bean2']:checked").val() == 1) {
                $("[name='money_tag_rate']").each(function () {
                    if ($(this).find("[name='off_money_rat']").val() == "" || $(this).find("[name='discount_rate']").val() == "") {
                        off_money_add_flag = false;
                        return false;
                    }
                    var item = {};
                    item["off_money"] = $(this).find("[name='off_money_rat']").val();
                    item["discount_rate"] = $(this).find("[name='discount_rate']").val();
                    items.push(item);
                });
            }
            if (!off_money_add_flag) {
                $("#errormsg").html("请填写完整的活动规则").show(300).delay(3000).hide(300);
                return false
            }
            if (!money_size_flag) {
                $("#errormsg").html("满金额不能小于或等于减金额").show(300).delay(3000).hide(300);
                return false
            }
            data["bean.money_off"] = JSON.stringify(items);
            return data;
        }
    }
</script>
